<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>设置电子文件批量挂接任务</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"
    />
    <link rel="stylesheet" href="../js/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="../style/admin.css" media="all"/>
    <link rel="stylesheet" href="../style/home.css" media="all"/>
    <script src="../js/layui/layui.js"></script>
    <style>

    </style>
</head>
<body>
<div class="layui-card " style=" height: 350px; padding: 20px 20px 0 0">
    <form class="layui-form" lay-filter="postData" action="" id="postData">
        <input type="hidden" name="id" value="put" th:value="${data.id}"/>
        <input type="hidden" name="pid" value="put" th:value="${data.pid}"/>
        <input type="hidden" name="tid" value="put" th:value="${data.tid}"/>
        <input type="hidden" name="classifyModel" value="put" th:value="${data.classifyModel}"/>
        <input type="hidden" name="classifyId" value="put" th:value="${data.classifyId}"/>

        <div class="layui-col-xs6">
            <label class="layui-form-label">任务名称</label>
            <div class="layui-input-block">
                <input type="text" name="batchCode" lay-verify="required" autocomplete="off" class="layui-input"
                       th:value="${data.batchCode}"/>
            </div>
        </div>
        <div class="layui-col-xs6">
            <label class="layui-form-label">图像类别</label>
            <div class="layui-input-block">
                <select name="model" lay-filter="model" lay-verify="required"
                        lay-search="">
                    <option value="1" th:selected="${'1' eq data.model}">扫描图像</option>
                    <option value="2" th:selected="${'2' eq data.model}">已处理图像</option>
                </select>
            </div>
        </div>
        <div class="layui-col-xs12">
            <label class="layui-form-label">挂接目录</label>
            <div class="layui-input-block">
                <input type="text" name="filename" lay-verify="required" autocomplete="off" class="layui-input"
                       th:value="${data.filename}"/>
            </div>
        </div>

        <div class="layui-col-xs6">
            <label class="layui-form-label">覆盖文件</label>
            <div class="layui-input-block">
                <input type="checkbox" value="1" name="overwrite" title="" th:checked="${data.overwrite=='1'}">
            </div>
        </div>
        <button type="submit" class="layui-btn" lay-submit="" lay-filter="postData" id="postBut"
                style="display: none">
            保存
        </button>
    </form>
</div>
<script>
    var callBackReturn = false;

    var index = parent.layer.getFrameIndex(window.name);
    layui
        .config({
            base: '../layui/exts/', //静态资源所在路径
        })
        .use(['util', 'form'], function () {
            var form = layui.form;
            var $ = layui.$;
            var upload = layui.upload;

            form.render();
            form.on('submit(postData)', function (obj) {
                var data = obj.field;
                $.ajax({
                    url: './saveImagesImportTask',
                    dataType: 'json',
                    type: 'POST',
                    async: false,
                    contentType: 'Application/json',
                    data: JSON.stringify(data),
                    success: function (result) {
                        if (result.code === 0) {
                            parent.layer.msg(result.message, {icon: 1});
                            callBackReturn = true;
                            parent.layer.close(index);
                        } else {
                            parent.layer.alert(result.message, {icon: 2});
                        }
                    },
                });
                return false;
            });
        });


    function Submit() {
        document.getElementById('postBut').click();
        return callBackReturn;
    }
</script>
<script type="text/javascript" src="../js/lib/watermark.js"></script>
</body>
</html>
